#include <stdio.h>
#include "ofc/DBool.h"

int main(int argc, char *argv[])
{
  DBool *flg1  = [DBool alloc];
  DBool *flg2  = [DBool new  ];
  DBool *flg3  = [DBool new  ];
  DText *str;
  char   txt[] = "false";
  char  *txtp  = txt;

  [flg1 init :YES];                 // Init the flag to true/yes

  [flg2 set  :YES];                 // Set the flag to true/yes
  
  if ([flg3 fromString :&txtp] == 0)  // Read the flag from a string
    printf("Boolean correctly converted from a string\n");
  else
    printf("No boolean value in the string\n");

  str = [flg2 toText];              // Convert the flag to a string
  printf("Flag2 is %s\n", [str cstring]);

  if ([flg2 compare :flg3] == 0)    // Compare flags
    printf("Flag2 and flag3 are equal\n");
  else
    printf("Flag2 and flag3 are different\n");

  [str  free];
  [flg1 free];                      // Cleanup
  [flg2 free];
  [flg3 free];

  return 0;
}

